<%@ page contentType="text/html; charset=UTF-8" %>
<%@ include file="/WEB-INF/taglib/jstl.jsp" %>

<c:set var="isRevise" value="${false}"/>
<c:set var="styleRevise" value="" />
<c:if test="${not empty grpInfo}">
	<c:set var="isRevise" value="${true}"/>
	<c:set var="styleRevise" value="style='background-color:#E3E3E3;' readonly='readonly'" />
</c:if>
<div style="margin:2px 2px 2px 2px;">
	<form id="frmGrpReg">
		<table class="left-table">
		<tr>
			<td class="grpTitleTd">아이디</td>
			<td class="grpContsTd"><input type="text" id="grpId" name="grpId" value="${grpInfo.grpId}" ${styleRevise} /></td>
		</tr>
		<tr>
			<td class="grpTitleTd">그룹 이름</td>
			<td class="grpContsTd"><input type="text" id="grpAlias" name="grpAlias" value="${grpInfo.grpAlias}" /></td>
		</tr>
		<tr>
			<td class="grpTitleTd">역할</td>
			<td class="grpContsTd">
				<select id="roleId" name="roleId">
				<option value="">역할 선택</option>
				<c:choose>
					<c:when test="${not empty roleList}">
						<c:forEach var="items" items="${roleList}" varStatus="i">
						<c:set var="selected" value="" />
						<c:if test="${items.roleId == grpInfo.roleId}">
							<c:set var="selected" value="selected='selected'" />
						</c:if>
						<option value="${items.roleId}" ${selected}>${items.roleAlias }</option>
						</c:forEach>
					</c:when>
					<c:otherwise></c:otherwise>
				</c:choose>
				</select>
			</td>
		</tr>
		<tr>
			<td class="grpTitleTd">사용 여부</td>
			<td class="grpContsTd">
				<c:set var="grpUseY" value="checked='checked'" />
				<c:set var="grpUseN" value="" />
				<c:if test="${isRevise && grpInfo.grpUseYN == 'N'}">
					<c:set var="grpUseY" value="" />
					<c:set var="grpUseN" value="checked='checked'" />
				</c:if>

				<input type="radio" name="grpUseYN" value="Y" ${grpUseY} />Y
				&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="radio" name="grpUseYN" value="N" ${grpUseN} />N
			</td>
		</tr>
		<tr>
			<td class="grpTitleTd">필수 그룹 여부</td>
			<td class="grpContsTd">
				<c:set var="grpCompulsoryY" value="" />
				<c:set var="grpCompulsoryN" value="checked='checked'" />
				<c:if test="${isRevise && grpInfo.grpCompulsoryYN == 'Y'}">
					<c:set var="grpCompulsoryY" value="checked='checked'" />
					<c:set var="grpCompulsoryN" value="" />
				</c:if>

				<input type="radio" name="grpCompulsoryYN" value="Y" ${grpCompulsoryY} />Y
				&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="radio" name="grpCompulsoryYN" value="N" ${grpCompulsoryN} />N
			</td>
		</tr>
		<tr>
			<td class="grpTitleTd" style="height:86px;">설명</td>
			<td class="grpContsTd">
				<textarea id="grpDesc" name="grpDesc" style="width:95%; height:80px; resize:none;">${grpInfo.grpDesc}</textarea>
			</td>
		</tr>
		</table>
	</form>
</div>
<div class="grpBtnsDiv">
	<c:choose>
	<c:when test="${isRevise}"><input type="button" id="jqwFormReviseSaveBtn" value="수정" /></c:when>
	<c:otherwise><input type="button" id="jqwFormSaveBtn" value="저장" /></c:otherwise>
	</c:choose>

	<input type="button" id="jqwCloseBtn" value="닫기" />
</div>

<script type="text/javascript" src="/resources/js/views/template/system/group/_regForm.js"></script>
<script type="text/javascript" src="/resources/js/views/template/system/group/_regFormValid.js"></script>